<template lang="html">
  <div class="box">
      <div class="header">
          <el-form class="filterCondition demo-form-inline" :inline="true" label-width="80px">
              <el-input placeholder="输入收件人" v-model="keyword" style="width: 420px;">
                <el-button slot="append" style="width: 120px;" @click="search()">搜索</el-button>
              </el-input>
              <el-form-item label="时间段" style="margin-bottom: 0;width: 520px;">
                <el-date-picker v-model="intervalTime" type="daterange" align="right" unlink-panels range-separator="-"
                  start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;"
                  value-format="yyyy-MM-dd HH:mm:ss" >
                </el-date-picker>
              </el-form-item>
          </el-form>
      </div>

      <div class="body">
          <el-table :data="tableData.list" style="width: 100%">
              <el-table-column label="收件人" prop="man" align="center" width=""></el-table-column>
              <el-table-column label="联系电话" prop="phone" align="center" width=""></el-table-column>
              <el-table-column label="收件地址" prop="eq_num" align="center" width="">
                  <template slot-scope="scope">
                    <p>{{scope.row.address}}</p>
                    <p>{{scope.row.details}}</p>
                  </template>
              </el-table-column>
              <el-table-column label="状态" align="center" width="">
                  <template slot-scope="scope">
                    <p v-if="scope.row.status == 0">未发货</p>
                    <p v-if="scope.row.status == 1">已发货</p>
                    <p v-if="scope.row.status == 2">未支付</p>
                    <p v-if="scope.row.status == 3">当地领取</p>
                  </template>
              </el-table-column>
              <el-table-column label="支付时间" prop="time" align="center" width=""></el-table-column>
              <el-table-column label="发货时间" prop="hair_time" align="center" width=""></el-table-column>
          </el-table>
      </div>

      <div class="page_box">
          <el-pagination class="page" layout="prev, pager, next"
            @current-change="switchPage" :current-page="currentPage" :page-count='tableData.rows' >
          </el-pagination>
      </div>

  </div>
</template>

<script>
export default {
  data(){
    return {
      keyword:'',
      intervalTime:[],
      tableData:[],
      currentPage:1
    }
  },
  created(){
    this.bbyObdPost()
  },
  methods:{
    search(){
      this.bbyObdPost()
    },
    bbyObdPost(page = 1){
      this.currentPage = page;
      this.$http4.bbyObdPost({
        key: this.keyword,
        start_time: (this.intervalTime && this.intervalTime[0]) || '',
        end_time: (this.intervalTime && this.intervalTime[1]) || '',
        page: page
      }).then(res=>{
        this.tableData =
        res.data.code == 1?
        res.data.data :[]
      })
    },
    switchPage(p){
      this.bbyObdPost(p)
    }
  }
}
</script>

<style lang="css" scoped>
@import "../../../my-style/app.css";
/deep/ .el-input-group__append, .el-input-group__prepend{
  background-color: #3498E9;
  border: none;
  color: white;
}
/deep/ .table_box .preview-img{
  display:block;
  width: 100%;
  height: 30px;
}
.page_box{
  text-align: center;
}
</style>
